<?php
	class Store extends CI_Controller
	{
		public function __construct()
		{
			parent::__construct();
			$this->load->model('genre');
			$this->load->helper('url');
		}
		
		public function index()
		{
			if ( ! file_exists('application/views/store/index.php'))
			{
				// Whoops, we don't have a page for that!
				show_404();
			}
			$data['title'] = 'Store Index'; // Capitalize the first letter
				
			$data['genre']=$this->genre->get_genre();
			$this->load->view('templates/header', $data);
			$this->load->view('store/index', $data);
			$this->load->view('templates/footer', $data);
		}
		
		public function browse($genre)
		{
			if ( ! file_exists('application/views/store/browse.php'))
			{
				// Whoops, we don't have a page for that!
				show_404();
			}
			
			$data['title'] = 'Browse';
			
			$data['gen_alb']= $this->genre->get_genre_with_album($genre);
						
			$this->load->view('templates/header', $data);
			$this->load->view('store/browse', $data);
			$this->load->view('templates/footer', $data);
		}
		
		public function details($id)
		{
			if ( ! file_exists('application/views/store/details.php'))
			{
				// Whoops, we don't have a page for that!
				show_404();
			}
			$this->load->model('album');
			
			$data['title'] = 'Details';
			$data['albumTitle'] = $this->album->get_album_title_by_id($id);
			
			$this->load->view('templates/header', $data);
			$this->load->view('store/details', $data);
			$this->load->view('templates/footer', $data);
		}
	}
?>